Skip to content

Conversation

a7medev
Copy link
Contributor

@a7medev a7medev commented Aug 23, 2025

Description

We're working on implementing signature help in SourceKit-LSP (swiftlang/sourcekit-lsp#2250) and we faced a problem in VS Code where signature help wasn't triggered after accepting a completion item for a function, method, subscript, initializer, or enum case with associated values that would've normally had signature help if the user manually typed the ( after the signature name.

Here's a demo of the issue with a development version of SourceKit-LSP:

before.mp4

To fix this, we added a provideCompletionItem middleware that inspects completion items that might have signature help (functions, methods (includes subscripts), initializers, and enum cases) and injects an editor.action.triggerParameterHints command (if no other command was present). This results in signature help working pretty well with completion as shown in the video below.

after.mp4

Tasks

  • Required tests have been written
  • Documentation has been updated (N/A)
  • Added an entry to CHANGELOG.md if applicable

title: "Trigger Parameter Hints",
command: "editor.action.triggerParameterHints",
},
...item,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd like to confirm an existing command should be used when one is already defined on item.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, if we ever have a command on an item we keep that rather than overriding it with triggering signature help. This shouldn't matter as of now since SourceKit-LSP already doesn't set commands for completion items.

Copy link
Contributor

@plemarquand plemarquand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for this!

@plemarquand plemarquand merged commit 919b8ba into swiftlang:main Aug 26, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants